<?php


class Oop1
{
    protected $len = 5;
    protected $name = '';
    #公共属性
    protected static $classname = '三年级二班';
    #常量
    const CURRENT_INDEX = 1;
    public function make(){
        return $this->len.$this->show();
    }
    public function show(){
        return ' : is show';
    }

    #设置名称
    public function setName($name){
        $this->name = $name;
    }

    #获取名称
    public function getName(){
        return self::$classname.'是'.$this->name;
    }


    #在类里面读取静态变量
    public function getStaticVar(){
        return self::CURRENT_INDEX;
    }

}

//$op = new Oop1();
//echo $op->make();

//$zhangsan = new Oop1();
//$zhangsan->setName('张三');
//echo $zhangsan->getName();
//echo '<hr/>';
//$lisi = new Oop1();
//$lisi->setName('李四');
//echo $lisi->getName();
//echo Oop1::CURRENT_INDEX;

$varobj = new Oop1();
echo $varobj->getStaticVar();